//组合redux子模块+导出store实例
import { configureStore } from '@reduxjs/toolkit'
// 导入 子store 模块
import counterReducer from './modules/counter'
import settingReducer from './modules/setting'
import loginReducer from './modules/login'

// 该方法会生成一个 根store
export const store = configureStore({
  // export default configureStore({
  reducer: {
    // setting ===> 子store模块名：后面在组件中使用store数据的时候会用到
    counter: counterReducer,
    setting: settingReducer,
    login: loginReducer,
  },
})

export type RootState = ReturnType<typeof store.getState>
